﻿@model IEnumerable<Project.Domain.Entities.League>
@{var countmodel = Model.Count();}
@if (countmodel == 0)
{
    <div class="info" style="width: 488px;">
        <div class="titleleague">
            Empty
        </div>
        <div style="height: 25px;" class="mainHeader">
            <div style="width: 96px" class="title_date">Time</div>            
            <div style="width: 222px; padding-left: 25px;" class="title_date">Events</div>
            <div class="title_date" style="padding-left: 35px;">Odds</div>
        </div>
    </div>   
    <div class="clearAll"></div> 
}
else
{
    var next = 0;
    foreach (var league in Model)
    {
        if(next==0)
        {
            <div class="info" style="width: 488px; margin-bottom: 5px !important;margin-left: 2px !important;">
                <div class="titleleague">
                    @league.NameLeague
                </div>
                <div style="height: 25px;" class="mainHeader">
                    <div style="width: 78px" class="title_date">Time</div>
                    <div style="width: 315px; text-align:center;" class="title_date">Events</div>
                    <div class="title_date" style="padding-left: 35px;">Odds</div>
                </div>
                <div class="clearAll"></div>
                <!--List AllMatchOfLeague-->
                @{ Html.RenderAction("GetAllMatchOfLeague", "Sport", new {leagueid = league.LeagueId}); }
            </div>
        }
        else
        {
            <div class="info" style="width: 488px;margin-bottom: 5px !important; margin-top: 5px;margin-left: 2px !important; ">
                <div class="titleleague">
                    @league.NameLeague
                </div>
                <div style="height: 20px;" class="mainHeader">
                    <div style="width: 96px" class="title_date">Date</div>
                    <div style="width: 96px" class="title_date">Hour</div>
                    <div style="width: 176px; padding-left: 25px;" class="title_date">Events</div>
                    <div class="title_date" style="padding-left: 35px;">Odds</div>
                </div>

                <div class="clearAll"></div>
                <!--List AllMatchOfLeague-->
                @{ Html.RenderAction("GetAllMatchOfLeague", "Sport", new {leagueid = league.LeagueId}); }
            </div>
        }
        next += 1;
    }
}

<div id="betSlipZone" title="Gamebetplus Bet Slip" style="display:none;">

</div>
<script type="text/javascript">    
    $(document).ready(function () {
        $('div.categoryHeader').toggleClass('expanded');
        var classList = $('div.categoryHeader').next('.courseList');
        classList.show();

    });
    var collapseAllThatAreNotExpanded = function () {
        $('div.categoryHeader:not(.expanded) + div.courseList').hide();
        return false;
    };
    $('div.categoryHeader').click(function () {
        var $this = $(this);
        $this.toggleClass('expanded');
        var classList = $(this).next('.courseList');
        if ($this.hasClass('expanded')) {
            classList.show();
            return false;
        }
        else {
            classList.hide();
            collapseAllThatAreNotExpanded();
            return false;
        }
    });
    function gameplus_addSlip(id) {
        if ("@Request.IsAuthenticated" == "False") {
            alert("Please login to bet!");
            alert(id);
            return false;
        }
        else {
            $("#"+id).addClass('disable_point');
            var url = 'Sport/BetSlip';
            $.post(url, { id: id }, function (data) {
                $("#betSlipZone").html(data);
                popupBetSlip("betSlipZone", id);
            });
        }
    }
</script>

